import {defineStore} from 'pinia'
import {ref,computed} from 'vue'
import { getProducts } from '@/api/products';

//创建仓库

//state: 响应式状态 (90%)
//getter: 计算属性
//action: methods
export const useCountStore = defineStore('aId',()=>{
    //需要管理的状态
   const count = ref(0);
   const name=ref('');
   const arr = ref([1,2,4,5,6,7,8])

   //getter
   const doubleCount = computed(()=> count.value*2);

   async function getProductsInfo() {
        let result = await getProducts
   }

   return{count,name,arr, doubleCount}
})


